//修改报备客户
function modifyReportedCustomer() {
	//获取项目上下文路径
	var rootPath = $('#rootPath').val();
	
	var cusId = $('#cusId').val();
	var phone = $('#phone').val();
	var email = $('#email').val();
	var cname = $('#cname').val();
	var remark = $('#remark').val();
	if(phone == "" || email == "") {
		alert("手机跟邮箱不能为空！");
		
		return ;
	}
	
	//校验手机号和邮箱
	var re = /^1\d{10}$/;
	var re2 = /^0\d{2,3}-?\d{7,8}$/;	
	if (!re.test(phone) && !re2.test(phone)) {
        alert("请输入正确的手机号码");
        
        return;
    } 
	
	var re3 = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
	if (!re3.test(email)) {
        alert("请输入正确邮箱地址");
       
        return;
    } 
	var url = rootPath + "/customerManage/modifyReportedCustomer";
	$.post(
		url,
		{
			"cusId": cusId,
			"phone": phone,
			"email": email,
			"cname": cname,
			"remark": remark
		},
		function(data) {
			var flag = eval(data);
			if(flag == 1) {
				location.href = rootPath + "/page/goReportedCustomer";
			}else {
				alert("该客户已存在！无法报备！");
			}
		}
	);
	
}

